﻿using Sidvall.Serialization;

namespace Sidvall.IdentityManager.Data.Keys
{
    public class UserNameIndex
    {
        public string UserName { get; set; }
        
        public static UserNameIndex GetKey(IAspNetUsers item)
        {
            if (item == null)
                return null;
            if (item.UserName == null)
                return null;
            return new UserNameIndex()
            {
                UserName = item.UserName,
            };
        }
        public static UserNameIndex GetKey(string userName)
        {
            if (userName == null)
                return null;
            return new UserNameIndex()
            {
                UserName = userName,
            };
        }
        public static UserNameIndex ParseKey(string key)
        {
            return new UserNameIndex()
            {
                UserName = key,
            };
        }
        public override string ToString()
        {
            return this.UserName;
        }
    }
}